package com.xueqiu.lovepetmedicalmanagersystem.service.Impl;

import com.xueqiu.lovepetmedicalmanagersystem.mapper.SpecialtiesMapper;
import com.xueqiu.lovepetmedicalmanagersystem.pojo.Specialties;
import com.xueqiu.lovepetmedicalmanagersystem.pojo.VetSpecialties;
import com.xueqiu.lovepetmedicalmanagersystem.pojo.Vets;
import com.xueqiu.lovepetmedicalmanagersystem.service.SpecialtiesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xueqiu
 */
@Service
public class SpecialtiesServiceImpl implements SpecialtiesService {

    @Autowired
    private SpecialtiesMapper specialtiesMapper;

    /**
     * 根据员工专业ID查询单个员工专业
     * @param speId 员工专业ID
     * @return 员工专业对象；可能找不到为NULL
     */
    @Override
    public Specialties querySpecialtiesById(Integer speId) {
        return specialtiesMapper.querySpecialtiesById(speId);
    }

    /**
     * 根据员工专业名称查询单个员工专业；前提是员工专业名称无重复
     * @param speName 员工专业名称
     * @return 员工专业对象；可能找不到为NULL
     */
    @Override
    public Specialties querySpecialtiesByName(String speName) {
        return specialtiesMapper.querySpecialtiesByName(speName);
    }

    /**
     * 根据员工专业ID查询该专业下多个兽医
     * @param speId 员工专业ID
     * @return 绑定对象列表；含有兽医ID；可能找不到为EMPTY
     */
    @Override
    public List<VetSpecialties> queryVetSpecialtiesBySpeId(Integer speId) {
        return specialtiesMapper.queryVetSpecialtiesBySpeId(speId);
    }

    /**
     * 根据兽医ID查询单个兽医
     * @param vetId 兽医ID
     * @return 兽医对象；可能找不到为NULL
     */
    @Override
    public Vets queryVets(Integer vetId) {
        return specialtiesMapper.queryVets(vetId);
    }

    /**
     * 查询所有员工专业
     * @return 员工专业对象列表；可能找不到为EMPTY
     */
    @Override
    public List<Specialties> getAllSpe() {
        return specialtiesMapper.getAllSpecialties();
    }

    /**
     * 新增单个员工专业
     * @param specialties 数据源，不包含员工专业ID
     * @return 新增条数
     */
    @Override
    public Integer insertSpecialties(Specialties specialties) {
        return specialtiesMapper.insertSpecialty(specialties);
    }
}
